/*
 * @lc app=leetcode.cn id=344 lang=java
 *
 * [344] 反转字符串
 */

// @lc code=start
class Solution {
    public void reverseString(char[] s) {
        char tag;
        int len = s.length - 1;
        // ["H","a","n","n","a","h"] 6个
        if (len % 2 == 0) {
            for (int i = 0; i < len/2 ; i++) {
                tag = s[i];
                s[i] = s[len - i];
                s[len - i] = tag;
            }
        } else {
            for (int i = 0; i < len/2 + 1; i++) {
                tag = s[i];
                s[i] = s[len - i];
                s[len - i] = tag;
            }
        }
    }
}
// @lc code=end
